from django.conf.urls import url
from . import views

from rest_framework_jwt.views import obtain_jwt_token
urlpatterns = [
    #/users/usernames/(?P<username>\w{5,20})/
    url(r'^usernames/(?P<username>\w{5,20})/$',views.RegisterUsernameView.as_view(),name='usernamecount'),

    url(r'^$',views.RegisterCreateUserView.as_view()),

    url(r'^auths/', obtain_jwt_token),

    url(r'^infos/$',views.UserCenterInfoView.as_view()),

    url(r'^emails/$',views.UserUpdateEmailView.as_view()),

    url(r'^emails/verification/$',views.UserEmailActiveView.as_view()),

    url(r'^addresses/$',views.AddressView.as_view()),

    url(r'^browerhistories/$',views.UserHistoryView.as_view()),
]

"""
header:      eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
payload:     eyJ1c2VyX2lkIjozLCJlbWFpbCI6IiIsImV4cCI6MTU0MTY0ODAyMiwidXNlcm5hbWUiOiJpdGNhc3QifQ.
signature:   puR6Ckc4t_nb-iLVQp5px1qEM01tyC4MKxFhyLgI8XI
"""

"""
1.当我们去输入用户名和密码的时候，我们是传递给了jet_token
    rest_framework_jwt 是建立在 rest_framework的基础至上的
    rest_framework_jwt 的认证 也是建立在 rest_framework
2.系统只是使用的用户名来进行的判断，
  我们的需求是 除了用户名还需要使用手机号进行登录

  User.objects.get(mobile=mobile)
  User.objects.get(username=username)
"""

from django.contrib.auth.backends import ModelBackend